#pragma once

#include <gofcl_timer_r.h>

typedef enum {
	TIMER_CHCV_0_R = TIMER_CH0CV_R,
	TIMER_CHCV_1_R = TIMER_CH1CV_R,
	TIMER_CHCV_2_R = TIMER_CH2CV_R,
	TIMER_CHCV_3_R = TIMER_CH3CV_R,
} timer_chcv_re;

static inline timer_re timer_get_chcv_r(timer_chcv_re channel_r) {
	return (timer_re)channel_r;
}

static inline void timer_wreg_chcv(timer_qe timer_q, timer_chcv_re channel_r,
				   u32_s chval) {
	timer_re chcv_r = timer_get_chcv_r(channel_r);
	timer_wreg_u16(timer_q, chcv_r, T16B_0_R, chval);
}

static inline u32_s timer_rreg_chcv(timer_qe timer_q, timer_chcv_re channel_r) {
	timer_re chcv_r = timer_get_chcv_r(channel_r);
	return timer_rreg_u16(timer_q, chcv_r, T16B_0_R);
}
